package com.wiscamp.ninechapters.problems.domain.repositories;

import com.wiscamp.ninechapters.problems.domain.models.tasks.Task;
import cube.ddd.common.query.PagedObjects;
import cube.ddd.common.query.PagedQuery;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;

import java.time.LocalDate;
import java.util.Collection;

public interface TaskRepository {
    Task getTask(@Min(0) long taskId);

    Task getTask(@Min(0) long assignmentId, @Min(0) long detailId, @Min(0) long setId, @Min(0) long userId);

    Task getLastTaskBySet(@Min(0) long setId, @Min(0) long userId, @Min(0) int taskStatusId);

    Collection<Task> getTasksBySet(long assignmentId, long setId);

    boolean removeTasksByStatus(long assignmentId, long setId, int taskStatus, Collection<Long> userIds);

    Task saveTask(@NotNull Task task);

    PagedObjects<Task> getTasksByQuery(@NotNull PagedQuery query);

    Collection<Task> getTasksByUserAndStatus(@Min(0) long userId, int statusId);

    Collection<Task> getPagedTasksByUserAndStatus(@Min(0) long userId, @Min(0) int pageNumber, int statusId);

    boolean updateTasksStatus(int uncompletedStatus, int abandonedStatus, String startDate, String endDate);

    void deleteAbandonTasks(int abandonedStatus, String startDate, String endDate);

    Task getFirstTask(long setId, long userId, int taskStatus);

    int getUserTasksQuantity(long userId);

    int getUserTaskQuantityByStatus(long userId, int statusId);

    int getTaskQuantityByDate(LocalDate datetimeStart, LocalDate datetimeEnd);
}
